/**strcat strcpy strncpy memset*/
/**strcmp*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void)
{
	char *str="world";
	char buf[128]={'H','e','l','l','o',' '};
	strcat(buf,str);
	puts(buf);

	strcpy(buf,str);
	puts(buf);

	//memset(buf,0x0,sizeof(buf));
	bzero(buf,sizeof(buf));
	strncpy(buf,"but ehllo world",9);
	puts(buf);

	printf("%d\n",strcmp("ABC","ABC"));
	printf("%d\n",strcmp("ABC","a"));
	printf("%d\n",strcmp("a","ABC"));

	char *ptr=NULL;
	//ptr=strchr(str,'l');
	ptr=strrchr(str,'l');
	if(NULL != ptr){
		printf("character:%c\n",*ptr);
		printf("offset:%ld\n",ptr-str);
	}

	ptr=strstr(str,"ld");
	if(NULL !=ptr){
		printf("string:%s\n",ptr);
		printf("offset:%ld\n",ptr-str);
	}

	return 0;
}
